﻿define(function () {
    var _that;
    var _classUtil = function () {
        _that = this;
    }

    _classUtil.prototype.extend = function (child, parent) {
        var F = function () { };
        F.prototype = par.prototype;
        child.prototype = new F();
        child.prototype.constructor = child;
        child.uber = parent.prototype;
    }

    _classUtil.prototype.extend2 = function (child, parent) {
        var p = parent.prototype;
        var c = child.prototype;
        for (var i in p) {
            c[i] = p[i];
        }
        c.uber = p;
    }

    _classUtil.prototype.getUrlParams = function () {
        return _that.getQueryParams(document.URL);
    }

    _classUtil.prototype.getQueryParams = function (qs) {
        var parStrArr = qs.split('?');
        if (parStrArr[1]) {
            qs = parStrArr[1].split("+").join(" ");
        } else {
            return {};
        }
         
        var params = {}, tokens,
            re = /[?&]?([^=]+)=([^&]*)/g;

        while (tokens = re.exec(qs)) {
            params[decodeURIComponent(tokens[1])]
                = decodeURIComponent(tokens[2]);
        }

        return params;
    }

    var _instance = new _classUtil();
    return _instance;
});